﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ecdl.demo.persistence;
using ecdl.demo.model.expression;

namespace ecdl.demo.model.word {
    public class WordTaskPersistenceContributor : IPersistenceContributor {
        public void ContributeTypesTypes(DTODeserializer serializer) {
            serializer.AddType(typeof(WordTaskDTO));
            serializer.AddTaskElementAttribute(typeof(WordTaskDTO), "WordTask");
            serializer.AddExpressionElementAttribute(typeof(WordBookmarkRegexExpressionDTO), "BookmarkExists");
            serializer.AddExpressionElementAttribute(typeof(ParagraphExistsExpressionDTO), "ParagraphExists");
            serializer.AddExpressionElementAttribute(typeof(GraphicsExistsExpressionDTO), "GraphicsExists");
            serializer.AddExpressionElementAttribute(typeof(FontExpressionDTO), "Font");
            serializer.AddExpressionElementAttribute(typeof(FontStyleExpressionDTO), "FontStyle");
            serializer.AddExpressionElementAttribute(typeof(HeaderSelectorDTO), "SelectFooter");
            serializer.AddExpressionElementAttribute(typeof(FooterSelectorDTO), "SelectHeader");
            serializer.AddExpressionElementAttribute(typeof(TextSelectorDTO), "SelectText");
            serializer.AddExpressionElementAttribute(typeof(WordZoomExpressionDTO), "WordZoom");

        }

        public void ContributeOverrides(DTODeserializer serializer) {
            serializer.AddAttributeOverride(typeof(WordTaskDTO), "Expression", serializer.GetExpressionXmlElementAttributes());
            serializer.AttributeOverrides.Add(typeof(WordTaskDTO), "Preconditions", serializer.GetPreconditionXmlArrayAttributes());
        }
    }
}
